home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / c80tcog.lbr / BDOS.CQ / bdos.c
Text File  |  1985-08-09  |  2KB  |  73 lines

  1. /* bdos - call BDOS function from C/80 Version 2.0 */
  2. /* Version 1.2    1982/12/18 22:01        */
  3. /*
  4.     Inspired by the assembly language routine ACTDIR in
  5. David E. Cortesi's INSIDE CP/M: A Guide for Users and Programmers,
  6. Holt, Rinehart and Winston, New York 1982, p. 226-228.
  7.  
  8. C version:
  9.  
  10.     Copyright 1982    William G. Hutchison, Jr.
  11.             P.O. Box 278
  12.             Exton, PA 19341-0278
  13.             U.S.A.
  14.  
  15.             CompuServe 70665,1307
  16.  
  17.  
  18.  
  19.  
  20.     This  function may be used freely for any non-commercial
  21. purpose, provided that the user does  not  remove  or  alter
  22. this notice or the copyright statement.
  23.     Those  who  wish  to  sell  or lease this program, or to
  24. incorporate it into a product  for  sale  or  lease,  should
  25. apply to the author (above) for licensing information.
  26.     This  function is  not  covered  by  a  warranty, either
  27. express or implied. The author shall not be responsible  for
  28. any  damages (including consequential) caused by reliance on
  29. the  materials  presented,  including  but  not  limited  to
  30. typographical errors or arithmetic errors.
  31.  
  32.     This version is for C/80 Version 2 from Software Toolworks.
  33.  
  34.  
  35.  */
  36.  
  37. bdos(fcn, arg)            /* do BDOS function fcn with arg */
  38. unsigned fcn, arg;
  39. {
  40. switch    (fcn) {            /* is value already in HL?    */
  41.     case 12:
  42.     case 24:
  43.     case 27:
  44.     case 29:
  45.     case 31:
  46. arg;
  47. #asm
  48.     MOV    D,H
  49.     MOV    E,L
  50. #endasm
  51. fcn;
  52. #asm
  53.     MOV    C,L
  54.     CALL    5        ;CALL BDOS
  55.     RET            ;RETURN WITH RESULT IN HL
  56. #endasm
  57.     default:
  58. arg;
  59. #asm
  60.     MOV    D,H
  61.     MOV    E,L
  62. #endasm
  63. fcn;
  64. #asm
  65.     MOV    C,L
  66.     CALL    5        ;CALL BDOS
  67.     MOV    L,A        ;PUT IT INTO HL
  68.     MVI    H,0
  69.     RET            ;RETURN WITH RESULT IN HL
  70. #endasm
  71.     }
  72. }                /* end of bdos            */
  73.